﻿
Imports Moca.Db

Namespace Db.Impl

	''' <summary>
	''' DaoUser データアクセス
	''' </summary>
	''' <remarks></remarks>
	Public Class DaoUser
		Inherits AbstractDao
		Implements IDaoUser

		Public Function GetAll() As IList(Of UserEntity) Implements IDaoUser.GetAll
			Const C_SQL As String = "IDaoUser_GetAll"

			Using cmd As IDbCommandStoredProcedure = CreateCommandStoredProcedure(C_SQL)
				Return cmd.Execute(Of UserEntity)()
			End Using
		End Function

		Public Sub Add(value As UserEntity) Implements IDaoUser.Add
			Const C_SQL As String = "IDaoUser_Add"

			Using cmd As IDbCommandStoredProcedure = CreateCommandStoredProcedure(C_SQL)
				cmd.AddParameterValue(value.Name)

				cmd.ExecuteNonQuery()
			End Using
		End Sub

		Public Sub Del(value As UserEntity) Implements IDaoUser.Del
			Const C_SQL As String = "IDaoUser_Upd"

			Using cmd As IDbCommandStoredProcedure = CreateCommandStoredProcedure(C_SQL)
				cmd.AddParameterValue(value.Name)

				cmd.ExecuteNonQuery()
			End Using
		End Sub

		Public Sub Upd(value As UserEntity) Implements IDaoUser.Upd
			Const C_SQL As String = "IDaoUser_Del"

			Using cmd As IDbCommandStoredProcedure = CreateCommandStoredProcedure(C_SQL)
				cmd.AddParameterValue(value.Name)

				cmd.ExecuteNonQuery()
			End Using
		End Sub

	End Class

End Namespace
